Page({
  data: {
    userInfo:{},
    openid: "",
    iconList: [{
      icon: 'pay',
      color: 'red',
      badge: 120,
      name: '待付款'
    }, {
      icon: 'deliver',
      color: 'orange',
      badge: 5,
      name: '待收货'
    }, {
      icon: 'message',
      color: 'yellow',
      badge: 0,
      name: '待评价'
    }, {
      icon: 'recharge',
      color: 'olive',
      badge: 22,
      name: '退换/售后'
    }],
    gridCol:4,
    skin: false
  },
  onGotUserInfo:function(e){
    const that = this;
    wx.cloud.callFunction({
      name:"login",
      success: res => {
        console.log("云函数调用成功");
        that.setData({
          openid: res.result.openid,
          userinfo: e.detail.userInfo
        })
      console.log("e", e);
        that.data.userinfo.openid = that.data.openid;
        console.log("open", that.data.openid)
        console.log("userinfo",that.data.userinfo)
        wx.setStorageSync('userinfo', that.data.userinfo)
      },
      fail: res=>{
        console.log("云函数调用失败")
      }
    })
  
  },
  onLoad: function(options) {
    const ui = wx.getStorageSync('userinfo');
    this.setData({
      userinfo:ui,
      openid:ui.openid
    })
  }
})